package com.fitso.wicket.config;

import java.util.List;

import org.apache.wicket.request.target.coding.IRequestTargetUrlCodingStrategy;
import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;

/**
 * Utility class for setting up the application context and other startup
 * components.
 * 
 * @author timothystorm
 */
public class FitsoApplicationContext implements ApplicationContextAware {

	/** holds the application context **/
	private static ApplicationContext _cntx;

	/** holds the url strategies for all pages on the site **/
	private static List<IRequestTargetUrlCodingStrategy> _urlCodingStrategies;

	/**
	 * @return Fitso application context
	 */
	public static ApplicationContext getContext() {
		return _cntx;
	}

	/**
	 * @return URL strategies - configured in fitso-web-contex.xml
	 */
	public static List<IRequestTargetUrlCodingStrategy> getUrlCodingStragies() {
		return _urlCodingStrategies;
	}

	public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
		_cntx = applicationContext;
	}

	public void setUrlCodingStragies(List<IRequestTargetUrlCodingStrategy> urlCodingStrategies) {
		_urlCodingStrategies = urlCodingStrategies;
	}
}
